package com.yexiao.cofe.business.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yexiao.cofe.business.pojo.Product;
import com.yexiao.cofe.business.pojo.Store;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface StoreMapper extends BaseMapper<Store> {

    void modifyStoreMsg(@Param("storeId") String storeId,
                        @Param("name") String name,
                        @Param("address") String address,
                        @Param("phone") String phone,
                        @Param("openingHours") String openingHours,
                        @Param("coverImage") String coverImage,
                        @Param("sort") Integer sort);

    @Select("select * from store where store_id = #{storeId}")
    Store selectByStoreId(String storeId);

    @Update("update store set status = #{status} where store_id = #{storeId}")
    void modifyStatus(String storeId, Integer status);

    List<Product> listProduct(String storeId);

    List<Store> listStore(@Param("name") String name);

}
